export default {
    namespaced: true,
    state: {
        token: sessionStorage.getItem('token') || '',
        signKey: sessionStorage.getItem('signKey') || '',
    },
    mutations: {
        setToken: (state, data) => {
            state.token = data
            sessionStorage.setItem('token', data);
        },
        setSignKey: (state, data) => {
            state.signKey = data
            sessionStorage.setItem('signKey', data);
        },
    },
    actions: {
        // 登出
        logout({ commit }) {
            return new Promise((resolve) => {
                commit('setToken', '');
                commit('setSignKey', '');
                resolve();
            })
        },

    }
}
